package demo_09_26_04;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.Period;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import class_01.demo_01;

/**
 * @author:连志鹏
 * @className:work_01
 * @descrption:
 * @date: 2021/9/25 11:11
 * @version: 0.1
 * @since: 1.8
 */

//附加练习题 4——1
public class work_01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int op = 0;
        op = sc.nextInt();
        switch (op)
        {
            case 1:
                test1();
                break;
            case 2:
                test2();
                break;
            case 3:
                test3();
                break;
            case 4:
                test4();
                break;
            case 5:
                test5();
                break;
            case 6:
                test6();
                break;
            case 7:
                test7();
                break;
            case 8:
                test8();
                break;
            case 9:
                test9();
                break;
            case 10:
                test10();
                break;
            case 11:
                test11();
                break;
            case 12:
                test12();
                break;
            case 13:
                test13();
                break;

        }
    }

    public static void test1(){
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();

        int random = (int) (Math.random() * 10);

        int baiwei = number / 100 % 10;
        if(baiwei==random)
            System.out.println("是幸运会员");
        else System.out.println("不是幸运会员");

    }
    public static void test2(){
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入基本工资：");
        double wages = sc.nextDouble();
        wages = wages-3500;

        double newages = 0;
        if(wages>80000)
        {
            newages = (wages-262)*0.45-13505;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages));
        }
        else if(wages>50000)
        {
            newages = (wages-262)*0.35-5505;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else if(wages>35000)
        {
            newages = (wages-262)*0.30-2755;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else if(wages>9000)
        {
            newages = (wages-262)*0.25-1005;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else if(wages>4500)
        {
            newages = (wages-262)*0.20-555;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else if(wages>1500)
        {
            newages = (wages-262)*0.10-105;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else if(wages>0)
        {
            newages = (wages-262)*0.03;
            System.out.println("应缴纳税款"+newages);
            System.out.println("税后实际收入"+(wages+3500-newages-262));
        }
        else {
            System.out.println("不需要缴纳税款");
            System.out.println("税后实际收入"+(wages+3500-262));
        }


    }
    public static void test3(){
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        for (int i = 1; i < num+1; i++) {
            for (int j =0; j < num+i-1;j++) {
                if (j<((2*num-1)-(2*i-1))/2)
//                    (2*num-1)-((2*num-1)-(2*i-1))/2
                    System.out.print(" ");
                else
                    System.out.print("*");
            }
            System.out.println();
        }

    }
    public static void test4(){
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();
        for (int i = 1; i < num+1; i++) {
            for (int j =0; j < num+i-1;j++)
                if (j < ((2 * num - 1) - (2 * i - 1)) / 2)
//                    (2*num-1)-((2*num-1)-(2*i-1))/2
                    System.out.print(" ");
                else
                    System.out.print("*");
            System.out.println();
        }
        for (int i = num-1; i >0 ; i--) {
            for (int j =0; j < num+i-1;j++) {
                if (j<((2*num-1)-(2*i-1))/2)
//                    (2*num-1)-((2*num-1)-(2*i-1))/2
                    System.out.print(" ");
                else
                    System.out.print("*");
            }
            System.out.println();
        }
    }

    public static void test5(){
        Scanner sc = new Scanner(System.in);


    }
    private static  int[] _leapdays = new int[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    private static  int[] _normaldays = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    public static void test6(){
        Scanner sc = new Scanner(System.in);
        Mydate date1 = new Mydate(2003,4,20);
        Mydate date2 = new Mydate(2003,4,18);

        int leapdays_Sum = 366;
        int normaldays_Sum = 365;

        int dateDiff1 = 0;
        int dateDiff2 = 0;


        for (int i = 0; i < date1.getYear()-1; i++) {
            if(i%4==0)
                dateDiff1 += 366;
            else
                dateDiff1 += 365;
        }
        for (int i = 0; i < date2.getYear()-1; i++) {
            if(i%4==0)
                dateDiff2 += 366;
            else
                dateDiff2 += 365;
        }
        for (int i = 0; i < date1.getMonth()-1 ; i++) {
            if((date1.getYear()%4==0)&&(i==1))
                dateDiff1 += 29;
            else
                dateDiff1 += _normaldays[i];
        }
        for (int i = 0; i < date2.getMonth()-1 ; i++) {
            if((date2.getYear()%4==0)&&(i==1))
                dateDiff2 += 29;
            else
                dateDiff2 += _normaldays[i];
        }
        dateDiff1 += date1.getDay();
        dateDiff2 += date2.getDay();

        int diff = dateDiff1-dateDiff2;

        LocalDate d1 = LocalDate.of(1900,1,1);
        LocalDate d2 = LocalDate.of(2003,4,18);

        Date a1 = new  Date(1900,1,1);
        Date a2 = new Date(2003,4,18);

        long dif = a1.getTime()-a2.getTime();
        System.out.println(TimeUnit.DAYS.convert(dif, TimeUnit.MILLISECONDS));


        Period per = Period.between(d1,d2);
        System.out.println(d1.toEpochDay()-d2.toEpochDay());
        System.out.println(diff);


    }
    public static void test7(){
        Scanner sc = new Scanner(System.in);
         double paper = 0.08;
         int ret = 1;
         while (true){
              if(paper*Math.pow(2,ret)>(8848.13*10*10*10))
                break;
              ret++;
         }
        System.out.println(paper*Math.pow(2,26));
        System.out.println(ret);

    }

    public static void test8(){
        Scanner sc = new Scanner(System.in);

        double length = 100;
        double sum = 100;
        for (int i = 0; i < 9; i++) {
            length = length/2;

            sum = length +sum;
        }
        System.out.println("反弹"+length/2+"经过"+sum);

    }
    public static void test9(){
        Scanner sc = new Scanner(System.in);
        demo_01 demo = new demo_01();

        int num = sc.nextInt();
        ArrayList list = new ArrayList();
        for (int i = 0; i < num; i++) {
            if(i%3==0)
                System.out.print(i+" ");
            list = demo.splitNum_01(i);
            for (int j = 0; j < list.size(); j++) {
                if((int)list.get(j)==3)
                {
                    System.out.print(i+" ");break;
                }
            }
        }
    }
    public static void test10(){
        Scanner sc = new Scanner(System.in);

        int[] num = new int[10];

        for (int i = 0; i < 10; i++) {
            num[i] = sc.nextInt();
        }

        int ret = 0;

        for (int i = 0; i < num.length; i++) {
            for (int j = 0; j < num.length-i-1; j++) {
                if(num[j]>num[j+1])
                {
                    ret = num[j];
                    num[j] = num[j+1];
                    num[j+1]= ret;
                }

            }
        }

        System.out.println(Arrays.toString(num));
    }
    public static void test11(){
        Scanner sc = new Scanner(System.in);
        demo_01 demo = new demo_01();

        int[] scoreList = new int[0];
        int score = 0;
        String str = null;

        while (true){
            System.out.println("请输入学生成绩：");
            score = sc.nextInt();
            scoreList =  demo.addList_01(scoreList,score);
            System.out.println("是否继续添加？y or f");
            str = sc.next();
            if (!str.equals("y"))
                break;
        }

        System.out.println(Arrays.toString(scoreList));

    }
    public static void test12(){
        Scanner sc = new Scanner(System.in);



    }
    public static void test13(){
        Scanner sc = new Scanner(System.in);
        int data = 0;
        int num[] = {6,7,9,5};
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                for (int k = 0; k < 4; k++) {
                    if((num[i]!=num[j])&&(num[i]!=num[k])
                            &&(num[j]!=num[k]))
                    {
                        data = num[i]*100+num[j]*10+num[k];
                        System.out.print(data+" ");
                    }

                }
            }
        }


    }
    public static void test14(){
            Scanner sc = new Scanner(System.in);
    }







}
class Mydate
{

    private int year;
    private int month;
    private int day;

    public Mydate(){            }
    public Mydate(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }




}